//
// Created by user on 2025/7/30.
//

#ifndef HELLOC_CONCURRENCY_HPP
#define HELLOC_CONCURRENCY_HPP

#include <iostream>
#include "systemc"
using namespace sc_core;
using namespace std;

class Concurrency : public sc_module {
public:
    Concurrency(sc_module_name name);

    void thread1();

    void thread2();


};

void Concurrency::thread1() {
    while (true) {
        wait(2, SC_SEC);
        cout << sc_time_stamp() <<": thread1" << endl;
    }
}

void Concurrency::thread2() {
    while (true) {
        wait(3, SC_SEC);
        cout << "\t" << sc_time_stamp() <<": thread2" << endl;
    }
}


Concurrency::Concurrency(sc_module_name name) : sc_module(name) {
    SC_THREAD(thread1);
    SC_THREAD(thread2);
}



#endif //HELLOC_CONCURRENCY_HPP
